﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApproveOrRejectOrder.aspx.cs" Inherits="Truextend.CoffeShop.Layouts.Truextend.CoffeShop.ApproveOrRejectOrder" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    
    <SharePoint:ScriptLink ID="showDailog" runat="server" Name="sp.js" Localizable="false" LoadAfterUI="true" /> 
    <script type="text/javascript">
        function ShowReasonDeletePopup() {

            var orderId = document.getElementById('<%= HFOrderId.ClientID %>').value;

            var options = {
                url: '/_layouts/Truextend.CoffeShop/ReasonToDelete.aspx?orderId='+orderId,
                tite: 'My Popup',
                allowMaximize: true,
                showClose: true,
                width: 500,
                height: 150,
                dialogReturnValueCallback: PopupCallback
            };

            SP.UI.ModalDialog.showModalDialog(options);
        }

        function PopupCallback(dialogResult, returnValue) {

            var btnReject = document.getElementById('<%= BtnReject.ClientID %>');
            btnReject.disabled = false;

            if (dialogResult == SP.UI.DialogResult.OK) {

                window.location = "../../CoffeeShop/SitePages/Home.aspx";
                
            }
        } 
    </script> 

    
    <div style="text-align: center;" ><h2>Approved Or Reject Order</h2></div>

    <br />
    <br />

    <center><table>    
        <tr>            
            <td>
                <asp:Label ID="LblTitle" runat="server" Text="Title: "></asp:Label>
            </td>
            <td>
                <asp:Label ID="LblTitleContent" runat="server" ></asp:Label>
            </td>
        </tr>

        <tr>            
            <td>
                <asp:Label ID="LblRestaurant" runat="server" Text="Restaurant: "></asp:Label>
            </td>
            <td>
                <asp:Label ID="LblRestaurantContent" runat="server" ></asp:Label>
            </td>
        </tr>

        <tr>            
            <td>
                <asp:Label ID="LblAddress" runat="server" Text="Address: "></asp:Label>
            </td>
            <td>
                <asp:Label ID="LblAddressContent" runat="server" ></asp:Label>
            </td>
        </tr>

        <tr>            
            <td>
                <asp:Label ID="LblPhones" runat="server" Text="Phones: "></asp:Label>
            </td>
            <td>
                <asp:Label ID="LblPhonesContent" runat="server" ></asp:Label>
            </td>
        </tr>

        <tr>            
            <td colspan="2">
                <div runat="server" ID="DivOptions" visible="true">
                <br />
                <br />
                        <center><asp:GridView ID="OptionsGridView" runat="server" AutoGenerateColumns="False" 
                            EnableModelValidation="True" DataKeyNames="OptionID" 
                            onrowdeleting="OptionsGridView_RowDeleting">            
                            <Columns>
                                                                
                                <asp:TemplateField HeaderText="OptionID" Visible="False">
                                    <ItemTemplate>
                                        <asp:Label ID="LblOptionID" runat="server" Text='<%# Bind("OptionID") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TxBxOptionID" runat="server" Text='<%# Bind("OptionID") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Product" SortExpression="Description">                
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TxBxDescripion" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>                                        
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="LblDescription" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
                                        <asp:HiddenField runat="server" Value='<%# Bind("OptionID") %>' ID="HFOptionId"/>
                                    </ItemTemplate>
                                </asp:TemplateField>
            
                                <asp:TemplateField HeaderText="Amount" SortExpression="Amount">                
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TxBxAmount" runat="server" Text='<%# Bind("Amount") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="LblAmount" runat="server"  Text='<%# Bind("Amount") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Price" SortExpression="Price">           
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TxBxPrice" runat="server" Text='<%# Bind("Price") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="LblPrice" runat="server" Enabled="false" Text='<%# Bind("Price") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Delete">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkDelete" runat="server" CausesValidation="False" 
                                            CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want delete this?')"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                            </Columns>        
                        </asp:GridView></center>        
                <br />
                </div>           
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="LblTotalPrice" runat="server" Text="Total Price: "></asp:Label>
            </td>
            <td>
                <asp:Label ID="LblTotalPriceContent" runat="server" ></asp:Label>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Button ID="BtnApprove" runat="server" Text="Approve" onclick="BtnApprove_Click" />
            </td>
            <td>
                <asp:HiddenField runat="server" ID="HFOrderId" />
                <asp:HiddenField runat="server" ID="HFIsReject" Value="No" />
                <asp:Button ID="BtnReject" runat="server" Text="Reject"
                OnClientClick="this.disabled = true;ShowReasonDeletePopup()" />                                    
                                
            </td>
        </tr>
        
        <tr>
            <td align="left">
                <asp:HyperLink ID="HLReturn" runat="server" NavigateUrl="~/CoffeeShop/SitePages/Home.aspx">Go Back</asp:HyperLink>                    
            </td>
        </tr>

    </table></center>    

</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Approved Or Reject Order
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
    Approved Or Reject Order
</asp:Content>
